<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>活动管理</el-breadcrumb-item>
      <el-breadcrumb-item>活动列表</el-breadcrumb-item>
    </el-breadcrumb>

  <!-- 卡片视图区------------------------------------------------------   -->
    <el-card>
      <!-- 搜索区开始----------------------------------- -->
      <el-row :gutter="20">
        <el-col :span="10">
          <el-input placeholder="请输入内容">
            <el-button slot="append" icon="el-icon-search"></el-button>
          </el-input>
        </el-col>
          <el-col :span="4">
            <el-button type='primary'>添加用户</el-button>
          </el-col>
        </el-row>
       <!-- 搜索区结束----------------------------------- -->

       <!-- 用户列表展示区-开始------------------------ -->
       <el-table :data="userlist">
        <el-table-column type="index" label="#"></el-table-column>
        <el-table-column prop="username" label="姓名"></el-table-column>
        <el-table-column prop="email" label="邮箱"></el-table-column>
        <el-table-column prop="mobile" label="电话"></el-table-column>
        <el-table-column prop="role_name" label="角色"></el-table-column>
        <el-table-column label="状态">
        </el-table-column >
       </el-table>
       <!-- 用户列表展示区-结束------------------------ -->
    </el-card>
  </div>
</template>

<script>
export default {
  data(){
    return{
      queryInfo:{
        query:'',
        pagenum:1,
        pagesize:3
      },
      //保存的数据列表
      userlist:[],
      //总的列表数
      total:0
    }
  },
  created(){
    this.getUserList()
  },
  methods:{
    //获取用户列表的数据
    async getUserList(){
      const{data:res}=await this.$http.get('users',{params:this.queryInfo})
      if(res.meta.status!==200) return this.$message.error('获取用户列表失败');
      console.log(res);
      //将获取的数据保存到userlist和total中
      this.userlist=res.data.users
      this.total=res.data.total
    }
  }
}
</script>

<style lang="less" scoped>

</style>